<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorator="layout/blank"><!-- layout文件路径-->
<head>
    <title>编辑Answer</title>
</head>
<body>
<div layout:fragment="content">

    <div class="row">
        <div class="col-md-12">

            <form class="form-horizontal" id="answerForm">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title" th:if="${isEdit} eq 'add'">新增answer</h3>
                        <h3 class="panel-title" th:if="${isEdit} eq 'edit'">编辑answer</h3>
                        <ul class="panel-controls">
                            <li>
                                <div class="pull-right">
                                    <a id="answer-add-button" th:data-questionid="${questionId}" th:data-unitid="${unitId}" th:data-levelid="${levelId}" class="btn btn-primary"><span class="fa fa-plus-circle"></span> 新建Answer</a>
                                </div>
                            </li>
                            <li><a href="#" class="panel-remove"><span class="fa fa-times"></span></a></li>
                        </ul>
                    </div>

                    <div class="panel-body">
                        <input type="hidden" name="questionId" id="questionId" th:value="${questionId}"/>
                        <input type="hidden" name="unitId" id="unitId" th:value="${unitId}"/>
                        <input type="hidden" name="levelId" id="levelId" th:value="${levelId}"/>

                        <div class="form-group" th:each="answer : ${answers}">
                            <label class="col-md-3 col-xs-12 control-label">答案</label>
                            <div class="col-md-6 col-xs-12">
                                <div class="input-group">
                                    <span class="input-group-addon">
                                        <input type="hidden"  name="id" th:value="${answer.id}">
                                        <input type="radio" th:if="${answer.rightAnswer=='1'}" checked name="rightAnswer" th:value="${answer.rightAnswer}">
                                        <input type="radio" th:if="${answer.rightAnswer=='0'}" name="rightAnswer" th:value="${answer.rightAnswer}">
                                    </span>
                                    <input type="text" class="form-control" name="title" th:value="${answer.title}"/>
                                </div>
                                <span class="help-block">如果是正确答案，请勾选前面的选择框</span>
                            </div>
                        </div>
                    </div>
                    <div class="panel-footer">
                        <a class="btn btn-primary pull-right" id="submit-answer-form-btn">提交</a>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

</body>
</html>
